package br.com.ctm.advogadope.mobile.bean;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

import br.com.framework.apresentacao.bean.BaseBean;

@Named
@ApplicationScoped
public class AppConfigurationMobileBean extends BaseBean {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Properties properties;
	
	@PostConstruct
	public void init() {
		InputStream inStream = getClass().getClassLoader().getResourceAsStream("/mobile.properties");
		properties = new Properties();
		try {
			properties.load(inStream);
		} catch (IOException e) {
			LOGGER.error(
				"Nao foi possivel inicializar o arquivo de configuracao: mobile.properties", e);
		}
	}

	public AppConfigurationMobileBean() {
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * @param key
	 * @return
	 */
	public String getProperty(String key) {
		return properties.getProperty(key);
	}

}
